const fs = require('fs')

const readDirFile = (dirName) => {
  fs.readdir(dirName, (err, files) => {
    const filesInfo = []
    for (const fileName of files) {
      const fileArr = fileName.split('.')
      filesInfo.push({
        pathName: `dirName/${fileName}`,
        fileName,
        type: fileArr.length > 1 ? fileArr.at(-1)  : 'dir'
      })
    }
    console.log(filesInfo)
  })
}

readDirFile('./vue-test')
